#include <stm8s_tim4.h>

ITStatus TIM4_GetITStatus(TIM4_IT_TypeDef TIM4_IT)
{
  ITStatus bitstatus = RESET;
  
  uint8_t itstatus = 0x0, itenable = 0x0;
  
  /* Check the parameters */
  assert_param(IS_TIM4_IT_OK(TIM4_IT));
  
  itstatus = (uint8_t)(TIM4->SR1 & (uint8_t)TIM4_IT);
  
  itenable = (uint8_t)(TIM4->IER & (uint8_t)TIM4_IT);
  
  if ((itstatus != (uint8_t)RESET ) && (itenable != (uint8_t)RESET ))
  {
    bitstatus = (ITStatus)SET;
  }
  else
  {
    bitstatus = (ITStatus)RESET;
  }
  return ((ITStatus)bitstatus);
}

/**
  * @brief Clears the TIM4's interrupt pending bits.
  * @param TIM4_IT specifies the pending bit to clear.
  * This parameter can be one of the following values:
  *                       - TIM4_IT_UPDATE: TIM4 update Interrupt source
  * @retval None.
  */
